<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:th="http://www.thymeleaf.org"
	   xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
	   xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"	  >
	<head>
	<meta http-equiv="Content-Type" content="text/html;"  charset="UTF-8"/>
	<title>天天点餐</title>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<meta name="description" content="Free HTML5 Website Template by GetTemplates.co" />
	<meta name="keywords" content="free website templates, free html5, free template, free bootstrap, free website template, html5, css3, mobile first, responsive" />
	<meta name="author" content="GetTemplates.co" />

  	<!-- Facebook and Twitter integration -->
	<meta property="og:title" content=""/>
	<meta property="og:image" content=""/>
	<meta property="og:url" content=""/>
	<meta property="og:site_name" content=""/>
	<meta property="og:description" content=""/>
	<meta name="twitter:title" content="" />
	<meta name="twitter:image" content="" />
	<meta name="twitter:url" content="" />
	<meta name="twitter:card" content="" />

	
	
	<!-- Animate.css -->
	<link rel="stylesheet" href="css/animate.css"/>
	<!-- Icomoon Icon Fonts-->
	<link rel="stylesheet" href="css/icomoon.css"/>
	<!-- Themify Icons-->
	<link rel="stylesheet" href="css/themify-icons.css"/>
	<!-- Bootstrap  -->
	<link rel="stylesheet" href="css/bootstrap.css"/>

	<!-- Magnific Popup -->
	<link rel="stylesheet" href="css/magnific-popup.css"/>

	<!-- Bootstrap DateTimePicker -->
	<link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css"/>

	<!-- Owl Carousel  -->
	<link rel="stylesheet" href="css/owl.carousel.min.css"/>
	<link rel="stylesheet" href="css/owl.theme.default.min.css"/>

	<!-- Theme style  -->
	<link rel="stylesheet" href="css/style.css"/>

	<!-- Modernizr JS -->
	<script src="js/modernizr-2.6.2.min.js"></script>
	<!-- FOR IE9 below -->
	<!--[if lt IE 9]>
	<script src="js/respond.min.js"></script>
	<![endif]-->

	</head>
<body>


<div class="modal fade" id="registerModal" tabindex="-1" role="dialog" aria-labelledby="registerModalLabel">
			  <div class="modal-dialog">
			    <div class="modal-content">
			      <div class="modal-header">
			        <button type="button" class="close" data-dismiss="modal" aria-label="true">
			         &times;
			       	</button>
			        <h4 class="modal-title" id="registerModalLabel">
			      		用户注册</h4>
			      </div>
			      <div class="modal-body">
			       		
			       		
			       		<div class="tab-content">
										<div class="tab-content-inner active" data-content="signup">
											
										<form name="form2" id="regUser" accept-charset="utf-8"  action="/addregister" method="post">
												<div class="row form-group">
													<div class="col-md-12">
														<label for="activities">账号</label>
														<input type="text" name="username" class="form-control"/>
													</div>
												</div>
												<div class="row form-group">
													<div class="col-md-12">
														<label for="date-start">密码</label>
														<input type="password" name="password" class="form-control"/>
													</div>
												</div>
												
												<div class="row form-group">
													<div class="col-md-12">
														<label for="date-start">确认密码</label>
														<input type="password" name="password2" class="form-control"/>
													</div>
												</div>
												<div align="right">
												 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
										         <button id="registerSaveBtn" type="submit" class="btn btn-primary">Save changes</button>
												</div>
											</form>	
										</div>
			       					</div>
			       
			      </div>
			 
			    </div><!-- /.modal-content -->
			  </div><!-- /.modal-dialog -->
			</div><!-- /.modal -->
<div class="gtco-loader"></div>



<div class="gtco-loader"></div>
	
<!-- 	<div id="page"> -->

	
	<!-- <div class="page-inner"> -->
	<nav class="gtco-nav" role="navigation">
		<div class="gtco-container">
			
			<div class="row">
				<div class="col-sm-4 col-xs-12">
					<div id="gtco-logo"><a href="#">天天点餐 <em>.</em></a></div>
				</div>
				<div class="col-xs-8 text-right menu-1">
				<a href="#" target="_blank">欢迎来到天天点餐平台</a>
					
				</div>
			</div>
			
		</div>
	</nav>
	
	<header id="gtco-header" class="gtco-cover gtco-cover-md" role="banner" style="background-image: url(images/img_bg_1.jpg)" data-stellar-background-ratio="0.5">
		<div class="overlay"></div>
		<div class="gtco-container">
			<div class="row">
				<div class="col-md-12 col-md-offset-0 text-left">
					

					<div class="row row-mt-15em">
						<div class="col-md-7 mt-text animate-box" data-animate-effect="fadeInUp">
							<span class="intro-text-small">Hand-crafted by <a href="#" target="_blank">GetTemplates.co</a></span>
							<h1 class="cursive-font">All in good taste!</h1>	
						</div>
						<div class="col-md-4 col-md-push-1 animate-box" data-animate-effect="fadeInRight">
							<div class="form-wrap">
								<div class="tab">
									
									<div class="tab-content">
										<div class="tab-content-inner active" data-content="signup">
											<h3 class="cursive-font">用户登录</h3>
											<form id = "loginfrom" name="loginfrom" accept-charset="utf-8" method="post">
												<div class="row form-group">
													<div class="col-md-12">
														<label for="activities">账号</label>
														<input type="text" name="userName" class="form-control"/>
													</div>
												</div>
												<div class="row form-group">
													<div class="col-md-12">
														<label for="date-start">密码</label>
														<input type="password" name="password" class="form-control"/>
													</div>
												</div>
												

												<div class="row form-group">
													<div class="col-md-12">
													<input type="submit" class="btn btn-primary btn-block" value="登录" th:onclick="'checkLogin()'"/> 
												
								
												
														
													
													</div>
													
													
													
														
													
													
												</div>
												
												<div class="row form-group">
													<div class="col-md-12">
													<a href="#">
														<input type="button" class="btn btn-primary btn-block register" value="注册"/>																											
													</a>
													</div>
												</div>
												
											</form>	
										</div>

										
									</div>
								</div>
							</div>
						</div>
					</div>
							
					
				</div>
			</div>
		</div>
	</header>

	
<!-- 	</div> -->
	
	
	<!-- jQuery -->
	<script src="js/jquery.min.js"></script>
	<!-- jQuery Easing -->
	<script src="js/jquery.easing.1.3.js"></script>
	<!-- Bootstrap -->
	<script src="js/bootstrap.min.js"></script>
	<!-- Waypoints -->
	<script src="js/jquery.waypoints.min.js"></script>
	<!-- Carousel -->
	<script src="js/owl.carousel.min.js"></script>
	<!-- countTo -->
	<script src="js/jquery.countTo.js"></script>

	<!-- Stellar Parallax -->
	<script src="js/jquery.stellar.min.js"></script>

	<!-- Magnific Popup -->
	<script src="js/jquery.magnific-popup.min.js"></script>
	<script src="js/magnific-popup-options.js"></script>
	
	<script src="js/moment.min.js"></script>
	<script src="js/bootstrap-datetimepicker.min.js"></script>


	<!-- Main -->
	<script src="js/main.js"></script>
	

	<script type="text/javascript">
		$(document).ready(function(){ 
			$('.register').click(function() {
				$('#registerModal').modal('show');			
			});  		
		}) 

		
	</script>
<script type="text/javascript">
function checkLogin() {
    var userName = $('#loginfrom input[name="userName"]').val();
    var password = $('#loginfrom input[name="password"]').val();
    var a = "服务员";
    var param = {
        userName : userName,
        password : password
    }

    $.ajax({
    	async : true,
    	type : "POST",
        url : "/login",
        contentType : "application/json",
        dataType : "json",
        data :JSON.stringify(param),    
        success : function(data) {
            if (data) {
            	
            		alert("恭喜你 " + userName + " 登录成功");
                    location.href = "/index";
            	 
            } else {
                alert("用户名或密码错误!");
                location.href = "/login";
            }

        }

    });

}
</script>


														 
</body>
</html>